#! /user/bin/env python
# -*- coding: UTF-8 -*-
__author__ = 'miaochenliang'


# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #
# import++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #
# ↓++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #
import os
import glob
from PyQt4 import uic


# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #
# def ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #
# ↓++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #
def uicToPY(in_path):
    with open(in_path.replace('.ui', '.py'), 'w') as f:
        uic.compileUi(in_path, f)


if __name__ == '__main__':
    file_path = os.path.join(os.path.dirname(os.path.dirname(__file__)),
                             'UI/').replace('\\', '/')
    func = lambda x: uicToPY(x)
    map(func, glob.glob(file_path+'*.ui'))
